<?php
    $phpexcel_temp_require_path = get_include_path();
    set_include_path(SYS_LIB . '/PHPExcel');
    require_once('PHPExcel.php');   
    set_include_path($phpexcel_temp_require_path);
    unset($phpexcel_temp_require_path);
    function require_reader($name){
        $phpexcel_temp_require_path = get_include_path();
        set_include_path(SYS_LIB . '/PHPExcel');
        //do reader require option
        $dir = dirname(__FILE__) . '/PHPExcel/Reader';

        //assertion to name
        if (!is_array($name)) $name = array($name);

        foreach($name as $class){
            if (file_exists($dir . "/${class}.php")){
                require_once("PHPExcel/Reader/${class}.php");
            }
        }
        set_include_path($phpexcel_temp_require_path);
    }
    function require_writer($name){
        $phpexcel_temp_require_path = get_include_path();
        set_include_path(SYS_LIB . '/PHPExcel');
        //do reader require option
        $dir = dirname(__FILE__) . '/PHPExcel/Writer';

        //assertion to name
        if (!is_array($name)) $name = array($name);

        foreach($name as $class){
            if (file_exists($dir . "/${class}.php")){
                require_once("PHPExcel/Writer/${class}.php");
            }
        }
        set_include_path($phpexcel_temp_require_path);
    }
?>
